package LeetCode.leetcode242;

import java.util.Set;

public class Main {
    public static void main(String[] args) {

    }

    public static boolean isAnagram(String s, String t) {
        int[] table = new int[26];
        if (s.length() != t.length())
            return false;
        char a;
        for (int i = 0; i < s.length(); i++) {
            a = s.charAt(i);
//            table[a % 26]++;
            table[a-'a']++;
        }
        for (int i = 0; i < t.length(); i++) {
            a = t.charAt(i);
//            table[a % 26]--;
            table[a-'a']--;
            if (table[a-'a'] < 0)
                return false;
        }
        return true;
    }
}
